package cn.wolfcode.cloud.productserver.web;

import cn.wolfcode.cloud.productserver.service.IProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import cn.wolfcode.cloud.domain.Product;

import java.util.List;

@RestController
@RequestMapping("/api/product")
public class ProductController {
    @RequestMapping("/hello")
    public String hello() {
        return "Order-server ---> content:3333";
    }

//    @Qualifier("IProductService")
    @Autowired
    public IProductService productService;

    @RequestMapping("/list")
    public List<Product> list() {

        return productService.list();
    }

    @RequestMapping("/find")
    public Product find(@RequestParam("id") Long id) {
        return productService.get(id);
    }


}
